﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Entities;


public partial class SiteMaster : System.Web.UI.MasterPage
{
    private CategoryManager pm = new CategoryManager();
    private SupplierManager sm = new SupplierManager();
    public BLShoppingCart card;
    public string totalPrice = "$0";
    public string totalQuantity = "0";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            rptSupplier.DataSource = sm.AllSupplier();
            rptSupplier.DataBind();
            rptCategory.DataSource = pm.AllCategory();
            rptCategory.DataBind();
        }
        
    }
    
    protected void btnAdvSearch_Click(object sender, EventArgs e)
    {
        Response.Redirect("Products.aspx?pr=" + ddlSearchByPrice.SelectedItem.Value);
    }

    private void ProcessingCart()
    {
        BLShoppingCart cart;
        if (Session["cart"] != null)
        {
            cart = (BLShoppingCart)Session["cart"];
            totalPrice = String.Format("{0:C}",cart.TotalPayment().ToString());
            totalQuantity = cart.TotalQuantity().ToString();
        }
    }
}
